package ch3.LoadBalanceModule;

/**
 * 表示下游部件的节点
 */

public class Endpoint {
    public final String host;
    public final int port;
    public final int weight;

    // 使用volatile修饰保障可见性，表示该部件是否在线（可用）
    private volatile boolean online = true;

    public Endpoint(String host, int port, int weight) {
        this.host = host;
        this.port = port;
        this.weight = weight;
    }

    public boolean getOnline() {
        return online;
    }

    public boolean isOnline() {
        return online;
    }

    public void setOnline(boolean online) {
        this.online = online;
    }
}
